﻿@model IEnumerable<Barry.BarbeSystem.Models.BarberCategory>
@{
    ViewBag.Title = "BarberCategroy";
}
@section header{
    <script type="text/javascript">

        $(document).ready(function () {
            var pager = $('#dg').datagrid('getPager'); // get the pager of datagrid
            pager.pagination({ showPageList: false });

        });

        function updateUser() {
            var row = $('#dg').datagrid('getSelected');
            if (row) {
                window.location.href = "/barbercategory/edit/" + row.Id;
            } else {
                $.messager.show({
                    title: '提示',
                    msg: "请选择行"
                });
            }
        }

        function destroyUser() {
            var row = $('#dg').datagrid('getSelected');
            if (row) {
                $.messager.confirm('Confirm', '你确定删除此项目类别吗?', function (r) {
                    if (r) {
                        $.post('/BarberCategory/Delete', { id: row.Id }, function (result) {
                            if (result.success) {
                                $('#dg').datagrid('reload'); // reload the user data  
                            } else {
                                $.messager.show({
                                    title: '提示',
                                    msg: "删除失败！"
                                });
                            }
                        }, 'json');
                    }
                });
            }
        }

    </script>
}


<div id="tb" style="padding: 5px; height: auto">
<div class="actionButton">
    @Html.ActionLink(" 新 建 ", "Create", null, new { @class = "easyui-linkbutton", @plain = "true", @iconcls = "icon-add" })
    <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-edit" plain="true"
        onclick=" updateUser() ">修改</a> <a href="javascript:void(0)" class="easyui-linkbutton"
            iconcls="icon-remove" plain="true" onclick=" destroyUser() ">删除</a>
</div>

</div>
<table id="dg" data-options="rownumbers:true,singleSelect:true,pagination:true"
    title="理发类别项目" class="easyui-datagrid" url="/barbercategory/pageindex" toolbar="#tb">
    <thead>
        <tr>
            <th field="Name" data-options="width:300">
                @Html.DisplayNameFor(model => model.Name)
            </th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>
